package com.itheima.dao;

import com.itheima.pojo.Order;
import com.itheima.pojo.OrderInfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrderDao {

    void insert(Order order);

    @Select("select * from t_order where member_id = #{id} and orderDate = #{orderDate} and setmeal_id = #{setmealId}")
    Order getByMemberIdAndDate(Integer id, String orderDate, Integer setmealId);

    @Select("select m.name `member`,s.name `setmeal`,o.orderDate `orderDate`,o.orderType `orderType` " +
            "from t_order o, t_member m, t_setmeal s where o.member_id = m.id and o.setmeal_id = s.id " +
            "and o.id = #{id}")
    OrderInfoVO findById(Integer id);
}
